local skel = fk.CreateSkill {
  name = "lb__zhukou",
}

Fk:loadTranslationTable {
  ["lb__zhukou"] = "逐寇",
  [":lb__zhukou"] = "当你受到伤害后，你可以弃置一名角色区域内一张牌，若为装备牌，你摸一张牌。",

  ["#lb__zhukou"] = "逐寇：你可以弃置一名角色区域内一张牌",
  ["#lb__zhukou-ask"] = "逐寇：弃置%dest一张牌",

  ["$lb__zhukou1"] = "小贼，哪里跑！",
  ["$lb__zhukou2"] = "这你躲不了啦！",
}

skel:addEffect(fk.Damaged, {
  anim_type = "masochism",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local ts = table.filter(room:getAlivePlayers(), function(p)
      return not p:isAllNude()
    end)
    if #ts == 0 then return end
    local ps = room:askToChoosePlayers(player, {
      targets = ts,
      min_num = 1,
      max_num = 1,
      skill_name = skel.name,
      prompt = "#lb__zhukou"
    })
    if #ps > 0 then
      event:setCostData(self, { tos = ps })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local t = event:getCostData(self).tos[1]
    room:doIndicate(player, { t })
    local card = room:askToChooseCard(player, {
      target = t,
      flag = "hej",
      skill_name = skel.name,
      prompt = "#lb__zhukou-ask::" .. t.id,
    })
    room:throwCard(card, skel.name, t, player)
    if Fk:getCardById(card).type == Card.TypeEquip then
      player:drawCards(1, skel.name)
    end
  end,
})

return skel
